/*********************************************************
 *
 * Filename: test_signal.c
 *   Author: jmdvirus
 *   Create: 2019年11月27日 星期三 17时28分58秒
 *
 *********************************************************/

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>

void SigActionFunc(int signum)
{
	printf("signum=%d\n", signum);
	exit(0);
}

typedef struct {
	int i;
} CMTest;

int main(int argc, char **args) {
	struct sigaction sigact;
    sigact.sa_handler = SigActionFunc;
    sigact.sa_flags = 0;
	for (int i = SIGHUP; i != SIGSYS; i++) {
		sigaction(i, &sigact, NULL);
	}

	CMTest *test = NULL;
	sleep(2);
	printf("-----------%d---------\n", test->i);

	sleep(5);

	exit(-1);
	return 0;
}

